package com.sz.designpattern.create5.singleton.lazy;

public class DoubleCheckLazySingleton {
    private static DoubleCheckLazySingleton singleton = null;
    Integer integer;

    private DoubleCheckLazySingleton() {
        integer = new Integer(10);
    }

    public static DoubleCheckLazySingleton getInstance(){
        if (singleton == null){
            synchronized (DoubleCheckLazySingleton.class) {
                if (singleton == null){
                    singleton = new DoubleCheckLazySingleton();
                }
            }
        }
        return singleton;
    }

    public Integer getInteger() {
        return integer;
    }
}
